home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 January: Mac OS SDK / Dev.CD Jan 97 SDK2.toast / Development Kits (Disc 2) / OpenDoc / OpenDoc Development / Debugging Support / OpenDoc™ Source Code / UI / DispTabl.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-08-28  |  3.8 KB  |  126 lines  |  [TEXT/MPS ]

  1. /*
  2.     File:        DispTabl.h
  3.  
  4.     Contains:    Definition of class DispatchTable, which is private to the implementation of
  5.                 ODDispatcher.
  6.  
  7.     Owned by:    Richard Rodseth
  8.  
  9.     Copyright:    © 1992 - 1995 by Apple Computer, Inc., all rights reserved.
  10.  
  11.     Change History (most recent first):
  12.  
  13.          <2>      9/8/95    jpa        Use official error number range for private
  14.                                     error [1281354]
  15.          <1>     5/13/94    RR        first checked in
  16.          <9>      2/9/94    NP        Tiger Team cleanup.
  17.          <8>     1/15/94    RR        WinState.h->WinStat.h,
  18.                                     Dispatch.h->Disptch.h
  19.          <7>     12/2/93    RR        Use new eventType definition
  20.          <6>     8/20/93    RR        Fixed array indexing bug
  21.          <5>     8/18/93    RR        Added GetDispatchInfo/UpdateDispatchInfo
  22.          <4>     8/18/93    RR        Use DictionaryList class
  23.          <2>    8/17/93    RCR        Use OrderedCollection instead of linked list, for monitors
  24.          <1>    8/10/93    RCR        first checked in
  25.  
  26.     To Do:
  27.     In Progress:
  28.         
  29. */
  30.  
  31. #ifndef _DISPTABL_
  32. #define _DISPTABL_
  33.  
  34. #ifndef _ODTYPES_
  35. #include "ODTypes.h"
  36. #endif
  37.  
  38. //=====================================================================================
  39. // Theory of Operation
  40. //=====================================================================================
  41.  
  42. /*
  43.     See Disptch.h
  44.  
  45.     Contains an array of dispatch modules for the first 256 event codes. If there are 
  46.     any more, they go in an overflow linked list. A Windows implementation might  use 
  47.     a hash table instead, since there are so many more messages.
  48.  
  49. */
  50.  
  51. //=====================================================================================
  52. // Constants
  53. //=====================================================================================
  54.  
  55. const ODEventType kODLastEvent = 255; //    Index of last entry in the dispatch table
  56.  
  57. // Check ErrorDef.idl before adding any new codes here, to make sure they're unique.
  58. const ODError kODErrDispatcherNotInitialized    = -29829;
  59.  
  60. //=====================================================================================
  61. // Scalar Types
  62. //=====================================================================================
  63.  
  64. //=====================================================================================
  65. // Classes defined in this interface
  66. //=====================================================================================
  67.  
  68. class DispatchTable;
  69.  
  70. //=====================================================================================
  71. // Classes used by this interface
  72. //=====================================================================================
  73.  
  74. class DispatchInfo;
  75. class OrderedCollection;
  76. class DictionaryList;
  77. class ODDispatchModule;
  78.  
  79. //=====================================================================================
  80. // Global Variables
  81. //=====================================================================================
  82.  
  83. //=====================================================================================
  84. // Class DispatchTable
  85. //=====================================================================================
  86.  
  87. class DispatchTable
  88. {
  89. public:
  90.  
  91.     DispatchTable();
  92.     
  93.         // Constructor
  94.         
  95.     ~DispatchTable();
  96.     
  97.         // Destructor
  98.  
  99.     void AddMonitor(ODEventType eventType, 
  100.                     ODDispatchModule* dispatchModule);
  101.                     
  102.     void RemoveMonitor(ODEventType eventType,ODDispatchModule* dispatchModule);
  103.     
  104.     void AddDispatchModule(ODEventType eventType, 
  105.                            ODDispatchModule* dispatchModule);
  106.                            
  107.     void RemoveDispatchModule(ODEventType eventType);
  108.     
  109.     ODDispatchModule* GetDispatchModule(ODEventType eventType);
  110.  
  111.     OrderedCollection* GetMonitors(ODEventType eventType);
  112.     
  113. protected:
  114.  
  115.     DispatchInfo* GetDispatchInfo(ODEventType eventType);
  116.     void UpdateDispatchInfo(ODEventType eventType, DispatchInfo* info);
  117.     
  118. private:
  119.  
  120.     DispatchInfo* fDispatchInfo[kODLastEvent + 1]; // An array for the first 256 event types
  121.     DictionaryList* fOverflowDispatchInfo;              // A dictionary for those that don't 
  122.                                                   // fit in the array
  123.                                         
  124. };
  125.  
  126. #endif // _DISPTABL_